﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL.RF.TestRecord;

public partial class ViewTest_ViewYourself_ViewTestItem_Record : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindTestItem_Record();
        }
    }

    private void BindTestItem_Record()
    {
        TestItem_Record testItem = new TestItem_Record();
        if (Request.QueryString["ID"] != null)
        {
            int id = int.Parse(Request.QueryString["ID"].ToString());
            GridView1.DataSource = testItem.TestItem_Record_GetbyID(id);
            GridView1.DataBind();            
        }
    }

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        BindTestItem_Record();
    }

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if ((bool)GridView1.DataKeys[e.Row.RowIndex].Values[1] == true)
            {
                e.Row.Cells[6].Text = "Pass";
            }
            else
            {
                e.Row.Cells[6].Text = "Fail";
                e.Row.Cells[6].ForeColor = System.Drawing.Color.Red;
            }
        }
    }
}
